{% extends "base.html" %}

{% block titulo %}Foro del Curso - {{thread.group.course.name}} - grupo {{thread.group.code}} {% endblock %}

{%block style%}<link rel="stylesheet" type="text/css" href="/stylesheets/postStyle.css" />{%endblock%}

{% block breadcrumbs %}<div id="middleBreadcrumb">
                            <a href="/home/">home</a> >
                       </div>
                        <div id="middleBreadcrumb">
                            <a href="/course/{{thread.group.course.code}}/{{thread.group.code}}/">{{thread.group.course.name}}</a> >
                        </div>
                        <div id="middleBreadcrumb">
                            <a href="/forum/{{thread.group.course.code}}/{{thread.group.code}}/">Foro</a> >
                        </div>
                        <div id="lastBreadcrumb">
                            {{thread.title}}
                        </div>{% endblock %}

{% block cuerpo %}
<a href="/post/{{thread.id}}/">Agregar un post al foro</a>
<br /><br />

{%for post in postList%}
<div id="post">
    <div id="user_info">{{post.creator.get_full_name}}</div>
    <div id="post_body">
        <div id="post_avatar_container">
            {%if post.creator.student%}
                <img id="avatar" src="{{post.creator.student.avatar.path}}" width="{{post.avatarWidth}}" height="{{post.avatarHeight}}"/>
            {%endif%}
            {%if post.creator.teacher%}
                <img id="avatar" src="{{post.creator.teacher.avatar.path}}" width="{{post.avatarWidth}}" height="{{post.avatarHeight}}"/>
            {%endif%}
        </div>
        <div id="post_title">{{post.title|title}}</div>
        <div id="post_date">
            {{ post.date|date:"D d F y"|title}} a las {{post.date|date:"P"}}
            </div>
        <div id="table_container">
            <table id="post_table">
                <tr>
                    <td class="esq_sup_izq"></td>
                    <td class="linea_sup"></td>
                    <td class="esq_sup_der"></td>
                </tr>
                <tr>
                    <td class="habla"></td>
                    <td rowspan="2" class="contenido">
                        <pre>{{post.content}}</pre>
                    </td>
                    <td rowspan="2" class="linea_der"></td>
                </tr>
                <tr>
                    <td class="linea_izq">&nbsp;</td> <!--esto es un mega parche-->
                </tr>
                <tr>
                    <td class="esq_inf_izq"></td>
                    <td class="linea_inf"></td>
                    <td class="esq_inf_der"></td>
                </tr>
            </table>
            <div id="voteArea">
                {%if post.isVoted%}
                    {%if post.voteFavor%}
                    <img src="/resources/webImages/thumbs-1_solid.png" alt="Votaste a favor"></img>
                    <img src="/resources/webImages/thumbs-2_idle.png" alt="Votaste a favor"></img>
                    {%else%}
                    <img src="/resources/webImages/thumbs-1_idle.png" alt="Votaste en contra"></img>
                    <img src="/resources/webImages/thumbs-2_solid.png" alt="Votaste en contra"></img>
                    {%endif%}
                {%else%}
                   {#{%if not post.isMine%}#}
                    <a class="voteFavor" href="/vote/{{thread.id}}/{{post.id}}/1/"></a>
                    <a class="voteAgainst" href="/vote/{{thread.id}}/{{post.id}}/0/"></a>
                    {#{%else%}#}
                    <!--<img src="/resources/webImages/thumbs-2_idle.png" alt="Votaste a favor"></img>
                    <img src="/resources/webImages/thumbs-1_idle.png" alt="Votaste en contra"></img>-->
                   {#{%endif%}#}
                {%endif%}
                <span id="postRating">{{post.rating}} </span>
            
            </div>
        </div>
    </div>
</div>

<br />
{%endfor%}
<br />
<a href="/post/{{thread.id}}/">Agregar un post al foro</a>

{% endblock %}
